﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;

namespace Streambolics.PtBurn
{
    internal class PtBurnTools
    {
        internal static bool FileNameToJob (FileInfo aFile, out string aJobName, out PtBurnJobStatus aJobStatus)
        {
            aJobName = aFile.Name.ToUpper().BeforeLast (".");

            switch (aFile.Extension.ToUpper ())
            {
                case ".JRQ":
                    aJobStatus = PtBurnJobStatus.Submitted;
                    return true;

                case ".QRJ":
                    aJobStatus = PtBurnJobStatus.InQueue;
                    return true;

                case ".INP":
                    aJobStatus = PtBurnJobStatus.Active;
                    return true;

                case ".DON":
                    aJobStatus = PtBurnJobStatus.Complete;
                    return true;

                case ".ERR":
                    aJobStatus = PtBurnJobStatus.Error;
                    return true;

                case ".JOB":
                    aJobStatus = PtBurnJobStatus.NotInQueue;
                    return true;

                default:
                    aJobStatus = PtBurnJobStatus.NotInQueue;
                    return false;
            }
        }

        internal static string StatusToString (PtBurnJobStatus aStatus)
        {
            // TODO : Make it somewhat better
            return aStatus.ToString().SeparateCamelWords ();
        }
    }
}
